using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace TangMonk.Models;

public class User
{
    [BsonId] [BsonIgnore] public string? Id { get; set; }
    public string Name { get; set; }
    public string? Sex { get; set; }
    public string? Age { get; set; }
    public string Phone { get; set; }
    public string? Email { get; set; }
    public string? IdentityCard { get; set; }
    public string? SocialSecurityCard { get; set; }
    public string? MedicareCard { get; set; }

    public string? Password { get; set; }

    public User()
    {
        Id = ObjectId.GenerateNewId().ToString();
        Name = string.Empty;
        Sex = string.Empty;
        Age = string.Empty;
        Phone = string.Empty;
        Email = string.Empty;
        IdentityCard = string.Empty;
        SocialSecurityCard = string.Empty;
        MedicareCard = string.Empty;
        Password = string.Empty;
    }

    public User(string name, string password)
    {
        Id = ObjectId.GenerateNewId().ToString();
        Name = name;
        Sex = string.Empty;
        Age = string.Empty;
        Phone = string.Empty;
        Email = string.Empty;
        IdentityCard = string.Empty;
        SocialSecurityCard = string.Empty;
        MedicareCard = string.Empty;
        Password = password;
    }

    public User(User user)
    {
        Id = string.IsNullOrEmpty(user.Id) ? ObjectId.GenerateNewId().ToString() : user.Id;
        Name = user.Name;
        Sex = user.Sex;
        Age = user.Age;
        Phone = user.Phone;
        Email = user.Email;
        IdentityCard = user.IdentityCard;
        SocialSecurityCard = user.SocialSecurityCard;
        MedicareCard = user.MedicareCard;
        Password = user.Password;
    }
}

public enum UserLoginType
{
    Phone,
    IdCard,
    Email,
    UserName
}